home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / Vertigo / Nub / GWorld.c next >
Encoding:
C/C++ Source or Header  |  2000-06-24  |  635 b   |  34 lines

  1. #define DISABLE_LOCAL_CALLTRACE        1        // Set to 1 to disable Call Traces for this file.
  2. #define DISABLE_LOCAL_DEBUG            0        // Set to 1 to disable all debugging for this file.
  3. #include "DebugUtils.h"
  4.  
  5. #include "GWorld.h"
  6.  
  7.  
  8.  
  9.  
  10.  
  11. GWorldPtr CreateGWorld(Rect *bounds)
  12. {
  13.     GWorldPtr    world = NULL;
  14.     OSStatus    err;
  15.     
  16.     
  17.     err = NewGWorld(&world,0,bounds,NULL,NULL,keepLocal | pixelsLocked | useTempMem);
  18.     dAssert((err == noErr) && (world != NULL));
  19.     if ((err != noErr) || (world == NULL))
  20.         return NULL;
  21.     
  22.     CGrafPtr port;
  23.     GDHandle gdh;
  24.     
  25.     GetGWorld(&port,&gdh);
  26.     SetGWorld(world,NULL);
  27.     
  28.     EraseRect(bounds);
  29.     
  30.     SetGWorld(port,gdh);
  31.     
  32.     return world;
  33. }
  34.